package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInNon1003;
import com.ims.core.doc.service.ITInNon1003Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 航空电子客票行程单Controller
 *
 * @author IMS
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/doc/hangkong")
public class TInNon1003Controller extends BaseController
{
    @Autowired
    private ITInNon1003Service tInNon1003Service;

    /**
     * 查询航空电子客票行程单列表
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInNon1003 tInNon1003)
    {
        startPage();
        List<TInNon1003> list = tInNon1003Service.selectTInNon1003List(tInNon1003);
        return getDataTable(list);
    }

    /**
     * 导出航空电子客票行程单列表
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:export')")
    @Log(title = "航空电子客票行程单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInNon1003 tInNon1003)
    {
        List<TInNon1003> list = tInNon1003Service.selectTInNon1003List(tInNon1003);
        ExcelUtil<TInNon1003> util = new ExcelUtil<TInNon1003>(TInNon1003.class);
        util.exportExcel(response, list, "航空电子客票行程单数据");
    }

    /**
     * 获取航空电子客票行程单详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInNon1003Service.selectTInNon1003ById(id));
    }

    /**
     * 新增航空电子客票行程单
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:add')")
    @Log(title = "航空电子客票行程单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInNon1003 tInNon1003)
    {
        return toAjax(tInNon1003Service.insertTInNon1003(tInNon1003));
    }

    /**
     * 修改航空电子客票行程单
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:edit')")
    @Log(title = "航空电子客票行程单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInNon1003 tInNon1003)
    {
        return toAjax(tInNon1003Service.updateTInNon1003(tInNon1003));
    }

    /**
     * 删除航空电子客票行程单
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkong:remove')")
    @Log(title = "航空电子客票行程单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInNon1003Service.deleteTInNon1003ByIds(ids));
    }
}
